home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / samples / ooftst05.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-27  |  951 b   |  38 lines  |  [TEXT/CWIE]

  1. // Copyright 1994 A.D. Software. All Rights Reserved
  2.  
  3. // OOFTEST5
  4.  
  5. // Simple stream I/O is used to interact with the user.
  6. // to demonstrate the date parsing
  7.  
  8. #include "oofile.hpp"
  9.  
  10.  
  11. int main()
  12. {
  13.     cout << "OOFILE Validation Suite - Test 5\n"
  14.          << "Today's date is : " << dbDate::today << endl << endl
  15.          << "Simple test to try the input routines of the dbDate type" << endl << endl
  16.          << "Keep entering sample date strings followed by return, or just return to exit" 
  17.          << endl << endl;
  18.  
  19.     short year, month, day;
  20.  
  21. // change the default date order
  22.     dbDate::sDefaultDateOrder=dbDate::orderMDY;
  23.     
  24.     for (;;) {
  25.         cout << "Enter a date (MDY): " << flush;
  26.         if (dbDate::istream2ymd(cin, year, month, day)) {
  27.             cout << " = (YMD) " << year << "/" << month << "/" << day << endl << endl;
  28.             cin.ignore(INT_MAX, '\n');
  29.             cin.clear();
  30.         }
  31.         else {
  32.             cout << "bad date" << endl;
  33.             break;
  34.         }
  35.     }
  36.     cout << endl << "done" << endl;
  37.     return EXIT_SUCCESS;
  38. }